<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>

<div id="app">
    
    <button @click="changeLoginType">切换登录方式</button>
    
    <template v-if="loginType == 'user-name'">
        <lable>Username</lable>
        <input type="text" placeholder="enter your username" key="1">
    </template>
    <template v-else-if="loginType == 'phone-number'">
        <lable>Phone Number</lable>
        <input type="text" placeholder="enter your phone number" key="2">
    </template>

</div>




<script>

    new Vue({
        el: "#app",
        data: {
            loginType: 'user-name'
        },
        methods: {
            changeLoginType: function () {
                if (this.loginType === 'user-name') this.loginType = 'phone-number';
                else if (this.loginType === 'phone-number') this.loginType = 'user-name'
            }
        }

    })


</script>

</body>
</html>